package sg.com.techstudio.ecc.controller;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import sg.com.techstudio.ecc.dao.SystemConfigDao;

@Controller
public class StaticPageController extends BaseController{
	private static final Log log = LogFactory.getLog(StaticPageController.class);

	@Override
	protected String getModuleFolder() {
		return "semidynamic/";
	}
	
	@Autowired
	private SystemConfigDao systemConfigDao;
	
	@RequestMapping(value="speaker"+SPRING_EXT)
	public String speaker(Model model) {
		log.debug("speaker entry()");
		
		model.addAttribute("speakerList", systemConfigDao.speakerList());
		
		return goToPageJsp("speaker");
	}
	
	@RequestMapping(value="session"+SPRING_EXT)
	public String session(Model model
			, @RequestParam(value="type", required=false) Integer type) {
		log.debug("session entry()");
		
		model.addAttribute("sessionList", systemConfigDao.sessionList(type));
		model.addAttribute("type", type);
		
		return goToPageJsp("session");
	}
	
	@RequestMapping(value="learningjourney"+SPRING_EXT)
	public String learningjourney(Model model) {
		log.debug("learningjourney entry()");
		
		model.addAttribute("learningJourneyList", systemConfigDao.learningJourneyList());
		
		return goToPageJsp("learningjourney");
	}
}
